from flask_restful import Api
from flask import Blueprint

from comment.utils.output import output_json
from shopping.resource.index.index_resource import ShoppingCategory, Shopping_HomeNewProduct, \
    Shopping_HomeRecommendProduct,Shopping_RecommendSubject

index_bp = Blueprint('index', __name__, url_prefix='/index')
index_api = Api(index_bp)

index_api.representation('application/json')(output_json)  # 这句代码替代了原本装饰器的作用。看flask文档的装饰器。装饰器装饰以后，使得在调

index_api.add_resource(ShoppingCategory, '/category', endpoint='category')
index_api.add_resource(Shopping_HomeNewProduct, '/home_new_product', endpoint='home_new_product')
index_api.add_resource(Shopping_HomeRecommendProduct, '/home_recommend_product', endpoint='home_recommend_product')
index_api.add_resource(Shopping_RecommendSubject, '/recommend_subject', endpoint='recommend_subject')
